<template>
    <div class="tuanduizhang">
        <div class="tuanduizhang-card">
            <div class="tuanduizhang-head">
                <Row :gutter="5">
                    <Col span="4">
                        <Input clearable v-model="searchData.tuandui_name" placeholder="账号" type="text"></Input>
                    </Col>
                    <Col span="20">
                        <ButtonGroup class="subSearch">
                            <Button :loading="search_loading" @click="searchGetList" type="primary"><Icon type="ios-pulse-strong"></Icon> 筛 选</Button>
                        </ButtonGroup>
                    </Col>
                </Row>
            </div>
            <i-table height="680" stripe :columns="columns" :data="data"></i-table>
            <div style="padding: 15px;">
                <Page @on-page-size-change="changeTiao" @on-change="changePage" :current="index" :total="total" show-elevator show-sizer :placement="'top'" :page-size="page_con" :page-size-opts="[10, 15, 20, 30, 40, 50]"></Page>
            </div>
        </div>
    </div>
</template>
<script>
    export default {
        name:"tuanduizhang",
        data(){
            return{
                columns:[
                    {
                        title: '序号',
                        type: 'index',
                        width: 60,
                        align:"center",
                    },
                    {
                        title: '团队长账号',
                        key: 'tuandui_name',
                        align:"center",
                    },
                    {
                        title: '金牌推手账号',
                        key: 'tuishou_name',
                        align:"center",
                    },
                    {
                        title: '金牌推手是否是团队长',
                        key: 'is_tuandui',
                        align:"center",
                        render:(h,params)=>{
                            if(params.row.is_tuandui==1){
                                return h("Icon",
                                    {
                                        props:{
                                            type:"checkmark-round",
                                            color:"green",
                                        }
                                    }
                                )
                            }else{
                                return h("Icon",
                                    {
                                        props:{
                                            type:"close-round",
                                            color:"red",
                                        }
                                    }
                                )
                            }
                        }
                    },
                    {
                        title: '升级时间',
                        key: 'up_time',
                        align:"center",
                        render:(h,params)=>{
                            return this.timeFormat(params.row.up_time)
                        }
                    },
                ],
                data:[],
                total:0,
                index:1,
                page_con:15,
                modal2:false,
                id:"",//操作的下标
                modal_loading:false,
                searchData:{
                    tuandui_name:"",//账号
                },
                search_loading:false,
            }
        },
        activated(){
            this.getGoodsBrand()
        },
        methods:{
            getGoodsBrand(){
                this.getJsonData("Users/tuanduizhangList",{
                    num:this.page_con,
                    page:this.index,
                    tuandui_name:this.searchData.tuandui_name,
                },true)
                    .then((res)=>{
                        this.data=res.data
                        this.total=parseInt(res.count)
                        this.search_loading=false
                    })
                    .catch((res)=>{
                        this.search_loading=false
                    })
            },
            changePage(n){
                this.index=n
                this.getGoodsBrand()
            },
            changeTiao(num){
                this.page_con=num
                this.index=1
                this.getGoodsBrand()
            },
            searchGetList(){
                this.search_loading=true
                this.index=1
                this.getGoodsBrand()
            },
        },
    }
</script>
<style lang="less">
    @import "tuanduizhang";
</style>